"""Archivo que contiene la clase que asocia la tabla Item'"""
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode

from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base

from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker

from zope.sqlalchemy import ZopeTransactionExtension

from sqlalchemy import Text

from sqlalchemy import Table, ForeignKey
from sqlalchemy.orm import relationship, backref

from scp.modelo.models import Base


class Item(Base):
	""" Clase que modela un item"""
	__tablename__ = 'item'
	id = Column(Integer, primary_key=True)
	codigo = Column(Unicode(50), nullable=False)
	nombre = Column(Unicode(50), nullable=False)
	descripcion = Column(Unicode(200))
	version = Column(Integer)
	flagUltimo = Column(Integer)
	flagBorrado = Column(Integer)	
	flagRevisar = Column(Integer)
	flagModificar = Column(Integer)
	estado = Column(Unicode(50))
	
		
	
	fase_id = Column(Integer, ForeignKey('fase.id'))
	linea_base_id = Column(Integer, ForeignKey('linea_base.id'))
	complejidad = Column(Integer)

	tipoItem_id = Column(Integer, ForeignKey('tipo_item.id'))
	tipoItem = relationship("Tipo_Item", backref="item")	
